/*
Binary Tree Level Order Traversal II

Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).

For example:
Given binary tree {3,9,20,#,#,15,7},
3
/ \
9  20
/  \
15   7
return its bottom-up level order traversal as:
[
[15,7],
[9,20],
[3]
]
confused what "{1,#,2,3}" means? > read more on how binary tree is serialized on OJ.
*/

#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <fstream>
#include <sstream>
#include "print.h"
using namespace std;

/**
* Definition for binary tree*/


void testForStack()
{
	stack<int> mystack;
	mystack.push(10);
	mystack.push(20);
	mystack.top() -= 5;
	cout << "mystack.top() is now " << mystack.top() << endl;
}

void testForIntToString()
{
	int a = 10;
	stringstream ss;
	ss << a;
	string str = ss.str();
	cout << str << endl;

	string str1 = to_string(a);

}





class Solution {
public:
	ListNode *mergeTwoLists(ListNode *l1, ListNode *l2) {
		ListNode *p = new ListNode(-1);

		ListNode *result = new ListNode(-1);

		p = result;


		if (l1 == NULL && l2 == NULL)
		{
			return NULL;
		}
		else if (l1 == NULL)
		{
			return l2;
		}
		else if (l2 == NULL)
		{
			return l1;
		}

		for (; l1 != NULL && l2 != NULL; p = p->next)
		{
			if (l1->val>l2->val)
			{
				p->next = l2;
				l2 = l2->next;
			}
			else
			{
				p->next = l1;
				l1 = l1->next;
			}
		}

		p->next = l1 != NULL ? l1 : l2;

		result = result->next;
		return result;

	}
};

int main(int argc, char* argv[])
{



	for (int i = 1; i < argc; i++){


		cout << argv[i] << endl;

	}

	int A[] = { 1, 2, 3, 0, 0 };
	int B[] = { 2, 4 };
	//cout << << endl;
	stack<int> st, st2;
	st.push(1);
	st.push(2);


	vector<vector<int> > levelInt(0);
	//stack<TreeNode*> stackTree;
	//vector<int> intVec;
	//intVec.push_back(1);
	//levelInt.push_back(intVec);


	TreeNode *p = new TreeNode(1);

	TreeNode *left = new TreeNode(2);
	TreeNode *right = new TreeNode(3);
	TreeNode *left1 = new TreeNode(4);
	TreeNode *right1 = new TreeNode(5);


	p->left = left;
	p->right = right;
	p->left->left = left1;
	p->left->right = NULL;
	p->right->right = right1;
	p->right->left = NULL;

	Solution s;
	//stackTree.push(p->left);
	//stackTree.push(p->right);
	

	system("pause");
	return 0;
}